package com.luu.game.service.logic.elfRareFactory;

import com.luu.game.constant.RareConstant;
import com.luu.game.constant.RobotConstant;
import com.luu.game.data.dto.ElfInfoDTO;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 稀有度A
 */
public class RareA implements BaseElfRare {

    @Override
    public Double elfUpLevelHpValue(Double value) {

        return RareConstant.A_UP_LEVEL_HP + value;
    }

    @Override
    public Double elfUpLevelValue(Double value) {
        final Double countProperty = PropertyAlgorithm.countProperty(RareConstant.A_UP_LEVEL_COMMON_MIN, RareConstant.A_UP_LEVEL_COMMON_MAX);
        return countProperty + value;
    }

    @Override
    public ElfInfoDTO robotValueCreate(Integer level) {
        ElfInfoDTO result = new ElfInfoDTO();
        final Double lowerProperty = RobotConstant.LOWER_PROPERTY;
        final double hp = level * RareConstant.A_UP_LEVEL_HP * lowerProperty + 10;
        final double atk = level * RareConstant.A_UP_LEVEL_COMMON_MAX * lowerProperty;
        final double defense = level * RareConstant.A_UP_LEVEL_COMMON_MAX * lowerProperty;
        final double speed = level * RareConstant.A_UP_LEVEL_COMMON_MAX * lowerProperty;

        result.setLv(level);
        result.setHp(hp);
        result.setAtk(atk);
        result.setDefense(defense);
        result.setSpeed(speed);

        return result;
    }
}
